<!DOCTYPE html>
<html lang="en">
<!--header-->
<include file="Public:header"/>
<!--header-->

    <section id="main-content">
        <section class="wrapper">
            <h3><i class="fa fa-angle-right"></i> 日志处理</h3>
            <div class="row mt">
                <div class="col-md-12">
                    <div class="content-panel">
                        <table class="table table-striped table-advance table-hover">
                            <h4><i class="fa fa-angle-right"></i> 日志列表</h4>
                            <hr>
                            <thead>
                           <form class="form-inline" role="form" action="{:U('index')}" method="post">
                                <select class="btn btn-theme04" name="sou"  style="width: 100px;float: left;margin-left: 20px;">
                                    <foreach name="admin" item="v">
                                        <option value="{$v.id}">{$v.numbers}</option>
                                    </foreach>
                                </select>
                                <input type="submit" class="btn btn-theme" value="搜索" style="float: left;margin-left:1%" />
                            </form>
                           <!--<select id="type" class="btn btn-theme04" name="type" style="margin-left: 40%;">
                               <option value="0">请选择导出用户的报考类别</option>
                               <foreach name="course_type" item="v">
                                   <option value="{$v.id}">{$v.name}</option>
                               </foreach>
                               <option value="50000">导出所有报考类别</option>
                           </select>-->
                           <div style="margin-left: 60%">
                               开始时间
                               <input type="date" id="start"  name="start">
                               结束时间
                               <input type="date" id="end"  name="end">
                               <a id="shan" href="###" class="btn btn-theme" style="margin-top: 0px;margin-left:5px;cursor: pointer;background: #68dff0;border: none;color: #fff">
                                   批量删除
                               </a>
                           </div>

                            <tr>
                                <th>编号</th>
                                <th>管理员头像</th>
                                <th>管理员姓名</th>
                                <th>管理员账号</th>
                                <th>日志内容</th>
                                <th>创建时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            <foreach name="list" item="v">
                            <tr>
                                <td>{$v.id}</td>
                                <td>
                                    <if condition = "$v['img'] == NULL">
                                        无
                                        <else/>
                                        <a class="fancybox" href="{$v.img}">
                                            <img class="img-responsive" src="{$v.img}" style="width: 60px;height: 60px;border-radius: 50%">
                                        </a>
                                    </if>
                                </td>
                                <td>{$v.name}</td>
                                <td>{$v.numbers}</td>
                                <td>{$v.content}</td>
                                <td>{$v.create_at|date="Y-m-d H:i:s",###}</td>
                            </tr>
                            </foreach>
                            </tbody>
                        </table>
                        <form action="{:U('index')}" method="post" name="frmss">
                            <div  style="margin: 0 auto;width: 800px;margin-bottom: 20px">
                                <if condition="$currpage == 1">
                                    <span class="badge" style="font-size: 15px">
                                        首页
                                    </span>
                                    <span class="badge" style="font-size: 15px">
                                        上一页
                                    </span>
                                    <else/>
                                    <span class="badge" style="font-size: 15px">
                                        <a href="{:U('index',array('currpage'=>1))}" style="color: #ffffff">首页</a>
                                    </span>
                                    <span class="badge" style="font-size: 15px">
                                        <a href="{:U('index',array('currpage'=>$currpage-1))}" style="color: #ffffff">上一页</a>
                                    </span>
                                </if>
                                <if condition="$currpage == $totalpage">
                                    <span class="badge" style="font-size: 15px">
                                        下一页
                                    </span>
                                    <span class="badge" style="font-size: 15px">
                                        尾页
                                    </span>
                                    <else/>
                                    <span class="badge" style="font-size: 15px">
                                        <a href="{:U('index',array('currpage'=>$currpage+1))}" style="color: #ffffff">下一页</a>
                                    </span>
                                    <span class="badge" style="font-size: 15px">
                                        <a href="{:U('index',array('currpage'=>$totalpage))}" style="color: #ffffff">尾页</a>
                                    </span>
                                </if>
                                <span class="badge" style="font-size: 15px">
                                    当前第 {$currpage} 页；共 {$totalpage} 页
                                </span>
                                <span class="badge" style="font-size: 15px">
                                    跳转到
                                <input type="text" name="currpage" style="width: 50px;height:18px;border-radius: 5px;color: black;text-align: center;margin-left: 4px;margin-right: 8px">页
                                <button id="tiao" style="color: #888888;width: 50px;height:18px;border-radius: 8px;margin: auto 0;border: none">确定</button>
                            </span>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </section>
    </section>
</section>
<!--footer-->
<include file="Public:footer"/>
<!--footer-->
<script type="text/javascript" src="__PUBLIC__/ui/lib/layer/2.4/layer.js"></script>
<script type="text/javascript">
    $(function() {
        //    fancybox
        jQuery(".fancybox").fancybox();
    });
</script>
<script>
    $("#shan").click(function () {
        var currpage = '{$currpage}';
        var start = $('#start').val();
        var end   = $('#end').val();

        layer.confirm('确认删除该时间段的日志吗？，删除后不可恢复！', {
            title: '日志删除提示：',
            btn: ['确定'] //可以无限个按钮
        }, function(index, layero){
            $.ajax({
                type:"post",
                data:{start:start,end:end},
                url:"{:U('shan')}",
                success:function (res) {
                    if(res == 1){
                        layer.open({
                            title: '',
                            content: "删除成功",
                        });
                        if(currpage == 1){
                            location.href="__APP__/Dashboard/Logs/index";
                        }else{
                            location.href="__APP__/Dashboard/Logs/index/currpage/"+currpage;
                        }
                    }
                    if(res == 2){
                        layer.open({
                            title: ''
                            ,content: "删除失败"
                        });
                        _pass = false;
                    }
                    if(res == 3){
                        layer.open({
                            title: ''
                            ,content: "请选择合适的删除时间范围！"
                        });
                        _pass = false;
                    }
                }
            })
        });
    })
    //custom select box
    $(function(){
        $('select.styled').customSelect();
    });
    //跳转页数检测
    $("#tiao").click(function () {
        if(document.frmss.currpage.value == "" || document.frmss.currpage.value > {$totalpage} || document.frmss.currpage.value < 1){
            return false;
        }
    })
</script>

</body>
</html>
